﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeCircularScale
    {
        public CircularScale SetCircularScale(CircularScale circularScale)
        {
            circularScale.BorderBrush = CircularBorderBrush==null? null : CircularBorderBrush.Brush;
            circularScale.BorderThickness = CircularBorderThickness;
            circularScale.Background = CircularBackground== null? null : CircularBackground.Brush;
            circularScale.Interval = CircularInterval ?? Double.NaN;
            circularScale.Logarithmic = CircularLogarithmic;
            if (CircularLogarithmBase < 2)
                CircularLogarithmBase = 2;
            circularScale.LogarithmBase = CircularLogarithmBase;
            circularScale.Maximum = CircularMaximum;
            circularScale.Minimum = CircularMinimum;
            circularScale.Prefix = CircularPrefix;
            circularScale.Radius = CircularRadius;
            circularScale.ScalingSet = CircularScalingSet;
            circularScale.ShadowEnabled = CircularShadowEnabled;
            circularScale.StartAngle = CircularStartAngle;
            circularScale.Suffix = CircularSuffix;
            circularScale.SweepAngle = CircularSweepAngle;
            circularScale.ToolTipText = CircularToolTipText;
            if(CircularScaleThickness != null && CircularScaleThickness >= 0 && CircularScaleThickness <= 1)
            {
                circularScale.ScaleThickness = CircularScaleThickness;
            }
            else
            {
                circularScale.ScaleThickness = null;
            }
            if (CircularCenterX != null && CircularCenterY != null && CircularCenterX.Value >= 0 && CircularCenterX.Value <= 1 && CircularCenterY.Value >= 0 && CircularCenterY.Value <= 1)
                circularScale.Center = new Point(CircularCenterX.Value, CircularCenterY.Value);
            else
                circularScale.Center = null;

            return circularScale;
        }
        private BrushEx circularBorderBrush;
        private Thickness circularBorderThickness;
        private BrushEx circularBackground;
        private double? circularInterval;
        private bool circularLogarithmic;
        private int circularLogarithmBase;
        private double? circularMaximum;
        private double? circularMinimum;
        private string circularPrefix;
        private double? circularRadius;
        private string circularScalingSet;
        private bool circularShadowEnabled;
        private double? circularStartAngle;
        private string circularSuffix;
        private double? circularSweepAngle;
        private string circularToolTipText;

        private double? circularScaleThickness;
        private double? circularCenterX;
        private double? circularCenterY;

        [Category("标尺")]
        [DisplayName("标尺边框颜色")]
        [Description("CircularBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularBorderBrush", "标尺边框颜色")]
        public BrushEx CircularBorderBrush
        {
            get
            {
                return circularBorderBrush;
            }

            set
            {
                circularBorderBrush = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺边框大小")]
        [Description("CircularBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularBorderThickness", "标尺边框大小")]
        public Thickness CircularBorderThickness
        {
            get
            {
                return circularBorderThickness;
            }

            set
            {
                circularBorderThickness = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺背景颜色")]
        [Description("CircularBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularBackground", "标尺背景颜色")]
        public BrushEx CircularBackground
        {
            get
            {
                return circularBackground;
            }

            set
            {
                circularBackground = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺步长")]
        [Description("CircularInterval")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularInterval", "标尺步长")]
        public double? CircularInterval
        {
            get
            {
                return circularInterval;
            }

            set
            {
                circularInterval = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺是否对数显示")]
        [Description("CircularLogarithmic")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularLogarithmic", "标尺是否对数显示")]
        public bool CircularLogarithmic
        {
            get
            {
                return circularLogarithmic;
            }

            set
            {
                circularLogarithmic = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺对数显示基数")]
        [Description("CircularLogarithmBase")]
        [Editor(typeof(UI.XProperty.Editors.XIntEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularLogarithmBase", "标尺对数显示基数")]
        public int CircularLogarithmBase
        {
            get
            {
                return circularLogarithmBase;
            }

            set
            {
                circularLogarithmBase = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺最大值")]
        [Description("CircularMaximum")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularMaximum", "标尺最大值")]
        public double? CircularMaximum
        {
            get
            {
                return circularMaximum;
            }

            set
            {
                circularMaximum = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺最小值")]
        [Description("CircularMinimum")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularMinimum", "标尺最小值")]
        public double? CircularMinimum
        {
            get
            {
                return circularMinimum;
            }

            set
            {
                circularMinimum = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺前缀")]
        [Description("CircularPrefix")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularPrefix", "标尺前缀")]
        public string CircularPrefix
        {
            get
            {
                return circularPrefix;
            }

            set
            {
                circularPrefix = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺半径")]
        [Description("CircularRadius")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularRadius", "标尺半径")]
        public double? CircularRadius
        {
            get
            {
                return circularRadius;
            }

            set
            {
                circularRadius = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺缩放")]
        [Description("CircularScalingSet")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularScalingSet", "标尺缩放")]
        public string CircularScalingSet
        {
            get
            {
                return circularScalingSet;
            }

            set
            {
                circularScalingSet = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺是否显示阴影")]
        [Description("CircularShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularShadowEnabled", "标尺是否显示阴影")]
        public bool CircularShadowEnabled
        {
            get
            {
                return circularShadowEnabled;
            }

            set
            {
                circularShadowEnabled = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺起始角度")]
        [Description("CircularStartAngle")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularStartAngle", "标尺起始角度")]
        public double? CircularStartAngle
        {
            get
            {
                return circularStartAngle;
            }

            set
            {
                circularStartAngle = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺后缀")]
        [Description("CircularSuffix")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularSuffix", "标尺后缀")]
        public string CircularSuffix
        {
            get
            {
                return circularSuffix;
            }

            set
            {
                circularSuffix = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺范围角度")]
        [Description("CircularSweepAngle")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularSweepAngle", "标尺范围角度")]
        public double? CircularSweepAngle
        {
            get
            {
                return circularSweepAngle;
            }

            set
            {
                circularSweepAngle = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺提示")]
        [Description("CircularToolTipText")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularToolTipText", "标尺提示")]
        public string CircularToolTipText
        {
            get
            {
                return circularToolTipText;
            }

            set
            {
                circularToolTipText = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺宽度(0-1)")]
        [Description("CircularScaleThickness")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularScaleThickness", "标尺宽度(0-1)")]
        public double? CircularScaleThickness
        {
            get
            {
                return circularScaleThickness;
            }

            set
            {
                circularScaleThickness = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺圆心X(0-1)")]
        [Description("CircularCenter")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularCenter", "标尺圆心X(0-1)")]
        public double? CircularCenterX
        {
            get
            {
                return circularCenterX;
            }

            set
            {
                circularCenterX = value;
                Refresh();
            }
        }
        [Category("标尺")]
        [DisplayName("标尺圆心Y(0-1)")]
        [Description("CircularCenterY")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "CircularCenterY", "标尺圆心Y(0-1)")]
        public double? CircularCenterY
        {
            get
            {
                return circularCenterY;
            }

            set
            {
                circularCenterY = value;
                Refresh();
            }
        }
    }
}
